package com.lykj.modules.shop.wrapper;

import com.lykj.core.mp.support.BaseEntityWrapper;
import com.lykj.core.tool.utils.BeanUtil;
import com.lykj.modules.shop.entity.StoreProduct;
import com.lykj.modules.shop.vo.StoreProductVO;

import java.util.Objects;

/**
 * 平台商品表包装类,返回视图层所需的字段
 *
 * @author cxl
 * @since 2022-01-13
 */
public class StoreProductWrapper extends BaseEntityWrapper<StoreProduct, StoreProductVO> {

	public static StoreProductWrapper build() {
		return new StoreProductWrapper();
	}

	@Override
	public StoreProductVO entityVO(StoreProduct storeProduct) {
		StoreProductVO storeProductVO = Objects.requireNonNull(BeanUtil.copy(storeProduct, StoreProductVO.class));

		//User createUser = UserCache.getUser(storeProduct.getCreateUser());
		//User updateUser = UserCache.getUser(storeProduct.getUpdateUser());
		//storeProductVO.setCreateUserName(createUser.getName());
		//storeProductVO.setUpdateUserName(updateUser.getName());

		return storeProductVO;
	}

}
